home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok59
/
menu
/
test.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
4KB
|
198 lines
MODULE Test;
IMPORT D := Display,
m := Menu,
I := Intuition,
e := Exec;
VAR
w: D.WindowPtr;
menu: I.MenuPtr;
msg: I.IntuiMessagePtr;
Msg: I.IntuiMessage;
menunum: INTEGER;
menuname,itemname: ARRAY 20 OF CHAR;
quit: BOOLEAN;
item: I.MenuItemPtr;
BEGIN
NEW(w);
IF (w#NIL) AND D.OpenWindow(w,"Test",20,20,600,180,NIL) THEN
D.Jam1(w); D.FrontPen(w,1); D.CursorOn(w);
D.Write(w,"Spiel mit dem Menü!"); D.WriteLn(w);
m.StartMenu(w.window);
m.NewMenu("Project");
m.NewItem ("Open..." ,"O");
m.Seperator;
m.NewItem ("Save" ,"S");
m.NewItem ("Save As..." ,"V");
m.Seperator;
m.NewItem2("Quit" ,"Q");
m.NewItem2("About" ,"A");
m.Seperator;
m.NewItemChecked("Create Icons",0X,TRUE);
m.NewMenu("Edit");
m.NewItem("Insert","B");
m.NewItem("Delete","E");
m.NewItem("Copy","Y");
m.NewItem("Move","M");
m.NewItem("UnMark","D");
m.Seperator;
m.NewItemChecked("Active","A",FALSE);
m.NewMenu("Streß");
m.NewItem("Dieses",0X);
m.NewItem("Menü",0X);
m.NewItem("hat",0X);
m.NewItem("sehr",0X);
m.NewItem("viele",0X);
m.NewItem("Items,",0X);
m.NewItem("so",0X);
m.NewItem("daß",0X);
m.NewItem("sie",0X);
m.NewItem("im",0X);
m.NewItem("Normal-",0X);
m.NewItem("fall",0X);
m.NewItem("nicht",0X);
m.NewItem("alle",0X);
m.NewItem("auf",0X);
m.NewItem("den",0X);
m.NewItem("kleinen",0X);
m.NewItem("Bild-",0X);
m.NewItem("schirm",0X);
m.NewItem2("passen","!!!");
m.NewItem("Dieses",0X);
m.NewItem("Problem",0X);
m.NewItem("nimmt",0X);
m.NewItem("einem",0X);
m.NewItem("Menu.mod",0X);
m.NewItem2("ab","!!!");
menu := m.EndMenu();
IF I.SetMenuStrip(w.window,menu^) THEN END;
IF I.int.libNode.version>=36 THEN
IF NOT I.ModifyIDCMP(w.window,LONGSET{I.closeWindow,I.vanillaKey,I.menuPick}) THEN
D.Write(w,"Sorry, kein Speicher!");
HALT(20);
END;
ELSE
I.OldModifyIDCMP(w.window,LONGSET{I.closeWindow,I.menuPick,I.vanillaKey});
END;
quit := FALSE;
WHILE ~quit DO
LOOP
msg := e.GetMsg(w.window.userPort);
IF msg#NIL THEN EXIT END;
e.WaitPort(w.window.userPort);
END;
Msg := msg^; e.ReplyMsg(msg);
IF I.menuPick IN Msg.class THEN
menunum := Msg.code;
WHILE menunum#I.menuNull DO
item := I.ItemAddress(menu^,menunum);
CASE I.MenuNum(menunum) OF
| 0:
menuname := "Project";
CASE I.ItemNum(menunum) OF
| 0: itemname := "Open..."
(* 1: is seperator *)
| 2: itemname := "Save"
| 3: itemname := "Save As..."
(* 4: is seperator *)
| 5: itemname := "Quit"; quit := TRUE
| 6: itemname := "About"
(* 7: is seperator *)
| 8: itemname := "Create Icons"
ELSE END
| 1:
menuname := "Edit";
CASE I.ItemNum(menunum) OF
| 0: itemname := "Insert"
| 1: itemname := "Delete"
| 2: itemname := "Copy"
| 3: itemname := "Move"
| 4: itemname := "UnMark"
(* 5: is seperator *)
| 6: itemname := "Active"
ELSE END
| 2:
menuname := "Streß";
itemname := "XXtes Item.";
itemname[0] := CHR(I.ItemNum(menunum) DIV 10 +ORD("0"));
itemname[1] := CHR(I.ItemNum(menunum) MOD 10 +ORD("0"));
ELSE END;
D.Write(w,"Menu gewählt: ");
D.Write(w,menuname);
D.Write(w,", Item: ");
D.Write(w,itemname);
IF I.checkIt IN item.flags THEN
IF I.checked IN item.flags THEN D.Write(w," aktiviert!")
ELSE D.Write(w," deaktiviert!") END;
END;
D.WriteLn(w);
menunum := item.nextSelect;
END;
END;
IF I.vanillaKey IN Msg.class THEN
CASE Msg.code OF
| ORD("q"),ORD("Q"):
D.Write(w,"Quit mit Tastatur gewählt!" ); D.WriteLn(w); quit := TRUE
| ORD("a"),ORD("A"):
D.Write(w,"About mit Tastatur gewählt!"); D.WriteLn(w);
ELSE END;
END;
IF I.closeWindow IN Msg.class THEN quit := TRUE END;
END;
D.Close(w);
END;
END Test.